﻿using Microsoft.Graphics.Canvas;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Documents;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using 纸片人.ConvertClass;
using 纸片人.win2dEffectControl.DataClass;
using 纸片人.CalculateControls;
// The Templated Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234235

namespace 纸片人.win2dEffectControl
{
    public sealed class StraightenEffectControl : EffectControl
    {
  
        private CheckBox maintainSizeCheckBox;
        private TextBoxSlider angleTexBoxSlider;
        private ComboBox interpolationModeComboBox;
        public override EffectOneSourceData OneEffetData { get; set; }

        List<CanvasImageInterpolation> listCanvasImageInterpolation = new List<CanvasImageInterpolation>();

        public StraightenEffectControl()
        {
            this.DefaultStyleKey = typeof(StraightenEffectControl);
            listCanvasImageInterpolation= EffectUtil.GetEnumList<CanvasImageInterpolation>();
            OneEffetData = new StraightenEffectData();
        }

        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            SetEffectName("拉伸效果", "StraightenEffect");



            maintainSizeCheckBox = GetTemplateChildFormName<CheckBox>(nameof(maintainSizeCheckBox));
            SetCheckBox(maintainSizeCheckBox, OneEffetData, nameof(StraightenEffectData.MaintainSize));



            angleTexBoxSlider = GetTemplateChildFormName<TextBoxSlider>(nameof(angleTexBoxSlider));
            SetTextBoxSlider(angleTexBoxSlider, OneEffetData, nameof(StraightenEffectData.Angle));

            interpolationModeComboBox = GetTemplateChildFormName<ComboBox>(nameof(interpolationModeComboBox));
            SetComboBox(interpolationModeComboBox, listCanvasImageInterpolation, OneEffetData, nameof(StraightenEffectData.InterpolationMode));
        }

    }
}